<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function looseEqual(a, b) {
        if (a === b) return true;
        const isObjectA = isObject(a);
        const isObjectB = isObject(b);
        if (isObjectA && isObjectB) {
          try {
            const isArrayA = Array.isArray(a);
            const isArrayB = Array.isArray(b);
            if (isArrayA && isArrayB) {
              return (
                a.length === b.length &&
                a.every((e, i) => {
                  return looseEqual(e, b[i]);
                })
              );
            } else if (a instanceof Date && b instanceof Date) {
              return a.getTime() === b.getTime();
            } else if (!isArrayA && !isArrayB) {
              const keysA = Object.keys(a);
              const keysB = Object.keys(b);
              return (
                keysA.length === keysB.length &&
                keysA.every((key) => {
                  return looseEqual(a[key], b[key]);
                })
              );
            } else {
              /* istanbul ignore next */
              return false;
            }
          } catch (e) {
            /* istanbul ignore next */
            return false;
          }
        } else if (!isObjectA && !isObjectB) {
          return String(a) === String(b);
        } else {
          return false;
        }
      }
    </script>
  </body>
</html>
